#ifndef AEROQUADMODEL_H
#define AEROQUADMODEL_H

#include "basemodel.h"
#include "aeroquadconnection.h"

class AeroQuadModel : public BaseModel
{
    Q_OBJECT
public:
    explicit AeroQuadModel(QObject *parent = 0);
    ~AeroQuadModel();

    QString toString();
    QString toLiveLogEntry();
    QString toRollLiveLogEntry();
    QString toPitchLiveLogEntry();
    QString toYawLiveLogEntry();

    int *getIPAddress();

    int	getRollGain(GCSCommon::GainValues gainType);
    int	getPitchGain(GCSCommon::GainValues gainType);
    int	getYawGain(GCSCommon::GainValues gainType);

    float getXPosition();
    float getYPosition();
    float getZPosition();
    float getXVelocity();
    float getYVelocity();
    float getZVelocity();

    int getRoll();
    int getPitch();
    int getYaw();
    int getRollRate();
    int getPitchRate();
    int getYawRate();

private:
    AeroQuadConnection *_connectionObj;

    float _deviceX;
    float _deviceY;
    float _deviceZ;
    float _deviceXVelocity;
    float _deviceYVelocity;
    float _deviceZVelocity;

    int _deviceRoll;
    int _devicePitch;
    int _deviceYaw;
    int _deviceRollRate;
    int _devicePitchRate;
    int _deviceYawRate;

    int _deviceGainsRoll[3];
    int _deviceGainsPitch[3];
    int _deviceGainsYaw[3];

    void createConnection();
    void destroyConnection();
    AeroQuadConnection *getConnection();

public slots:
    void processData(QString incomingData);

    void sendVICONValuesToArduino(QString VICONValues);
    void sendRollGainsToArduino(int gainValues[3]);
    void sendPitchGainsToArduino(int gainValues[3]);
    void sendYawGainsToArduino(int gainValues[3]);

    void changeIPAddress(int *newIPAddress);

};

#endif // AEROQUADMODEL_H
